package test;

import java.util.ArrayList;
import java.util.HashMap;

public class Statistics {

	public static void  sumpercent(int[] listnum,ArrayList<UserPoint> pts){
	HashMap<Integer, HashMap<Integer, Double>> percents=new HashMap<Integer, HashMap<Integer, Double>>();;
	HashMap<Integer, Double> percent=null;
	for(int i=0;i<listnum.length;i++){
		 percent=new  HashMap<Integer, Double>();
		for(int j=0;j<pts.size();j++){
			UserPoint p=pts.get(j);				
			if(p.clust_no==i){
				for(int cate:p.poiTfIdf1.keySet()){
					if(percent.containsKey(cate)){
						percent.put(cate, percent.get(cate)+1);
					}else{
						percent.put(cate, 1.0);
					}
				}
			}
		}
		percents.put(i, percent);
	}
	System.out.println(percents.toString());
	
	for(int i=0;i<listnum.length;i++){
		for(int cluster:percents.keySet()){
			if(cluster==i){
				HashMap<Integer, Double> tempercent=percents.get(cluster);
				for(int cate:tempercent.keySet()){
					tempercent.put(cate, tempercent.get(cate)/listnum[i]);				
				}	
			}			
		}
	}
	System.out.println(percents.toString());
	}	
	public static void main(String[] args) {
		// TODO Auto-generated method stub

	}

}
